

$(function() {
    
    var icons = {
        'text'              : '<i class="fa fa-edit"></i>',
        'number'            : '#',
        'email'             : '<i class="fa fa-envelope"></i>',
        'url'               : '<i class="fa fa-globe"></i>',
        'password'          : '<i class="fa fa-lock"></i>',
        'confirm-password'  : '<i class="fa fa-unlock"></i>',
        'color'             : '<i class="fa fa-tint"></i>',
        'location'          : '<i class="fa fa-edit"></i>',
        'longitude'         : '<i class="fa fa-pushpin"></i>',
        'latitude'          : '<i class="fa fa-pushpin"></i>'
    };
    
    // create form sortable
    $( "#form-sortable" ).sortable({
        cursor: 'move',
        handle: '.handle'
//        dropOnEmpty: true,
//        placeholder: 'sortable-placeholder'
    });
    
    $( ".sortable" ).sortable({
        cursor: 'move',
        handle: '.control-label',
        dropOnEmpty: true,
        placeholder: 'sortable-placeholder',
        connectWith: '.sortable-connected'
//        cancel: '.placeholder'
    });
    
    // fieldset form validation
    $("#wysiwyg-form").validate({
        errorElement: 'small',
        errorClass: 'help-block',
        errorPlacement:function(error, element) {
            element.parents('.input-size').append( '<div class="clear-fix"></div>' );
            element.parents('.input-size').append( error);
        },
        highlight: function(label) {
            $(label).closest('.form-group').removeClass('has-error has-success').addClass('has-error');
        },
        success: function(label) {
            label.addClass('valid').closest('.form-group').removeClass('has-error has-success').addClass('has-success');
        }
    });
    
    $('#test-btn').click(function() {
        
    });

});

